package com.cdie.myschool.mapper.TeacherTimeTableMapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.cdie.myschool.domain.entity.Classes;
import com.cdie.myschool.domain.entity.Course;
import com.cdie.myschool.domain.entity.Timetable;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 雷金臣199000347
 * @date 2022/10/8 - 16:38
 */
@Mapper
@DS("master")
public interface TeacherTimeTableMapper {
    @Select("select * from calendar where school_year=#{schoolYear} and semester=#{semester}")
    long getSemesterIdInCalendar(String schoolYear,String semester );

    @Insert("insert into timetable (semester_id,course_id,teacher_id,classes_id,timestamp)values(#{semesterId},#{courseId},#{teacherId},#{classesId},#{timestamp})")
    int InsertTeacherTimeTable(Timetable timetable);

    @Select("select *from timetable where teacher_id=#{teacherId} and semester_id=#{semesterId} ")
    List<Timetable> getTeachingTimeInformation(String teacherId ,String semesterId);

    @Select("select *from classes where class_code=#{classCode} ")
    Classes getClassesName(String classCode);

    @Select("select *from course where course_code=#{courseCode} ")
    Course getCourseName(String courseCode);

    @Select("select count(*) from student where student_class_code=#{studentClassCode} and school_roll_status=#{schoolRollStatus}")
    long getStudentNum(String studentClassCode,String schoolRollStatus);



}
